TEAMNAME=Jtacck
ZIPNAME=$(TEAMNAME)_SDS.zip
PDFLATEX=pdflatex

TEXS=architecture.tex slides.tex
DIAGRAMS := $(wildcard diagrams/*.uxf)

PDFS=$(TEXS:%.tex=%.pdf)
ZIPPDFS=$(PDFS:%=$(TEAMNAME)_%)
DIAGRAMPDFS=$(DIAGRAMS:%.uxf=%.pdf)

all: pdf zip

process.tex: risk-assessment.tex
	touch $@

architecture.tex: header.tex process.tex diagrams.tex design.tex $(DIAGRAMPDFS)
	touch $@

slides.tex: slides-header.tex $(DIAGRAMPDFS)
	touch $@

pdf: $(PDFS)

zip: pdf
	echo $(ZIPOTHERFILES)
	ls $(PDFS) $(OTHERFILES) | xargs -I '{}' cp {} Jtacck_{}
	zip $(ZIPNAME) -m $(ZIPPDFS) $(ZIPOTHERFILES)

clean:
	rm -f *.{aux,log,out,nav,toc,snm} *~

cleanall: clean
	rm -f $(PDFS) $(ZIPNAME)

%.pdf: %.tex
	while (echo "R\n" | $(PDFLATEX) $^ ; \
	grep -q "Rerun to get cross" `basename $^ .tex`.log ) do true ; \
	done

#%.pdf: %.uxf
#	umlet -action=convert -format=pdf -filename=$^

.phony: .phony pdf zip diagrams clean cleanall all